package com.hqq.exercise.divide_conquer;

/**
 * HanoiTower 汉诺塔问题
 * 思路:
 * 从圆柱A通过圆柱B把圆盘移动到圆柱C上
 * 每次都是先将其上的n-1和圆盘通过从A通过C移动到圆柱B上
 * 再把第n个圆盘从A通过B移动到C
 * 当A上只剩一个圆盘的时候 直接从A移动到C上即可
 * Created by heqianqian on 2017/8/28.
 */
public class HanoiTower {

    public static void move(int num, String from, String with, String to) {
        if (num >= 1) {
            move(num - 1, from, to, with);
            System.out.println("move " + num + " from " + from + " to " + to);
            move(num - 1, with, from, to);
        }
    }
}
